<template>
	<view class="content">
		<view class="content-block">
			<view class="title">{{detail.title}}</view>
			<view class="sub-title">发布时间：{{detail.create_time}}</view>
			<view class="article-content">
				<mp-html :content="detail.content"></mp-html>
			</view>
		</view>
		
	</view>
</template>

<script>
	import {getArticleDetail} from '@/api/article.js';
	export default{
		data(){
			return{
				detail:{
					
				}
			}
		},
		methods:{
			getDetail(id){
				uni.showLoading({
					title:'加载中',
					mask:true,
				})
				getArticleDetail({id}).then((res)=>{
					uni.hideLoading()
					if(res.status==1){
						this.detail=res.data;
					}else{
						this.utils.showToast(res.message,()=>{
							uni.navigateBack()
						})
					}
				}).catch((res)=>{
					this.utils.showToast('加载失败，请重试',()=>{
						uni.navigateBack()
					})
				})
			}
		},
		onLoad(e) {
			this.getDetail(e.id);
		}
	}
</script>

<style lang="scss">
	page{
		background: #EFEFEF;
	}
	
	.content{
		width: 100%;
		padding-bottom:20rpx;
		.content-block{
			background-color: #fff;
			padding: 30rpx;
			.title{
				font-size: 40rpx;
				font-weight: bold;
				margin-bottom: 30rpx;
			}
			
			.sub-title{
				font-size: 28rpx;
				color: #999;
				margin-bottom: 30rpx;
			}
		}
		
		
	}
</style>